//-----------------------------------------------------
// Design Name : 
// File Name : 
// Function : 
//-----------------------------------------------------
module Shifter (
	three_in, 
	four_in,
	data_in,
	data_out,
	immediate
); 
// Input Ports 
input [3:0] three_in; //[3] = sign : [2:0] shift amount
input [7:0] four_in;  //[4] = sign : [3:0] shift amount (immediate)
input [15:0] data_in;
input immediate;
// Output Ports 
output reg [15:0] data_out;

// Implementation
always@(*)
 if(immediate)
	if(four_in[4])
		data_out <= data_in >> four_in[3:0];
	else
		data_out <= data_in << four_in[3:0];
 else
	if(three_in[3])
		data_out <= data_in >> three_in[2:0];
	else
		data_out <= data_in << three_in[2:0];
endmodule 